
import java.util.Timer;
import javax.microedition.lcdui.game.Sprite;

/**
 *
 * @author Gerrit
 */
public class Enemy {
     /*De volgende List Intergers, zorgt ervoor dat elke object zijn eigen val, en jump, direction e.d. heeft.
     *      0 lastDirection;
     *      1 lastWalkDirection;
     *      2 jumpSpeed;
     *      3 fallingSpeed; spriteOptions[3]
     *      4 jumpedToMax; spriteOptions[4]
     */
    public float[] enimyWalk = {1, 1, 0, 0, 0};
    public Sprite enimy = null;
    private SpriteAnimationTask spriteEnimyAnimator = null;
    private Timer timer = new Timer();
    
    public Enemy() {
        LoadGraphics loadSprite = new LoadGraphics();
        //Laad de enemy in
        this.enimy = loadSprite.getSprite_enemy();
        this.spriteEnimyAnimator = new SpriteAnimationTask(this.enimy, true);
        this.timer.scheduleAtFixedRate(this.spriteEnimyAnimator, 0, 240);
    }
    
    public void moveEnemy() {
      if (enimyWalk[1] == 2 && enimyWalk[3] == 0) {  //Left = constant 2
          this.enimy.move(-3, 0);
          this.spriteEnimyAnimator.forward();
        } 
        else if(enimyWalk[3] == 0) {
          this.enimy.move(3, 0);
          this.spriteEnimyAnimator.forward();
        }   
    }
}
